<?php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');

class Home extends MY_Controller {

    public function index() {
        $this->_data["useMap"] = true;
        $this->_data["menuHL"] = "Home";
        $this->_data["imageFB"] = res_url("img/mapprev.jpg");

        // hlKegiatans
        $this->load->model("Kegiatan_model");
        $hlKegiatans = $this->Kegiatan_model->fetchHL();
        $this->_data["hlKegiatans"] = $hlKegiatans;

        // hlArtikels
        $this->load->model("Artikel_model");
        $this->_data["hlBerita"] = $this->Artikel_model->beritaHL();
        $this->_data["hlKR"] = $this->Artikel_model->krHL();
        $this->_data["hlPJ"] = $this->Artikel_model->pjHL();

        // fetch data kabupaten
        $this->load->model("Kabupaten_model");
        $kabList = $this->Kabupaten_model->readSummarized(Array("is_tertinggal" => 1));
        $this->_data["kabList"] = $kabList;
        $this->_data["titleFB"] = "Tahukah kamu? terdapat " . count($kabList) . " Kabupaten di Indonesia yang sedang berjuang meningkatkan taraf kesehatan";//masih tertinggal dalam kesehatan";

        $this->_renderPage("home");
    }

    public function error() {
        $this->_data["pageTitle"] = "Halaman tidak ditemukan";
        $this->_renderPage("404");
    }

}
